<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>加减法口算练习系统-v0.4</title>
    <style>
        body { font-family: Arial, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; }
        h1 { color: #333; text-align: center; }
        .stats { text-align: center; color: #666; margin: 10px 0 20px; }
        .exercise-container { margin: 30px auto; display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px; }
        .exercise { font-size: 18px; padding: 15px; border: 1px solid #ddd;
            border-radius: 5px; background-color: #f9f9f9; }
        .addition { border-left: 4px solid #4CAF50; }
        .subtraction { border-left: 4px solid #2196F3; }
        .input-group { margin: 10px 0; display: flex; align-items: center; gap: 10px; }
        input { width: 60px; padding: 8px; font-size: 16px; text-align: center; }
        button.check-btn { padding: 6px 12px; background-color: #555; color: white;
            border: none; border-radius: 4px; cursor: pointer; }
        button.check-btn:hover { background-color: #333; }
        .feedback { margin-top: 10px; padding: 8px; border-radius: 4px; display: none; }
        .correct { background-color: #dff0d8; color: #3c763d; display: block; }
        .incorrect { background-color: #f2dede; color: #a94442; display: block; }
        .empty { background-color: #fcf8e3; color: #8a6d3b; display: block; }
        .submit-all { text-align: center; margin: 30px; }
        #submitAllBtn { padding: 10px 20px; font-size: 18px; background-color: #2196F3;
            color: white; border: none; border-radius: 4px; cursor: pointer; }
        #submitAllBtn:hover { background-color: #0b7dda; }
    </style>
    <script>
        function checkAnswer(index, correctAnswer) {
            const input = document.getElementById('answer_' + index);
            const feedback = document.getElementById('feedback_' + index);
            const userAnswer = input.value.trim();

            // 清空之前的反馈样式
            feedback.classList.remove('correct', 'incorrect', 'empty');

            if (userAnswer === '') {
                feedback.textContent = '未填写答案，正确答案是: ' + correctAnswer;
                feedback.classList.add('empty');
            } else if (parseInt(userAnswer) === correctAnswer) {
                feedback.textContent = '答对了，真棒！';
                feedback.classList.add('correct');
            } else {
                feedback.textContent = '答错了，正确答案是: ' + correctAnswer;
                feedback.classList.add('incorrect');
            }
        }

        function submitAllAnswers() {
            const total = 50;
            for (let i = 0; i < total; i++) {
                const correctAnswer = parseInt(document.getElementById('correct_' + i).value);
                checkAnswer(i, correctAnswer);
            }
        }
    </script>
</head>
<body>
    <h1>加减法口算练习系统-v0.4</h1>
    <div class="stats">
        共50题（加法：28题，减法：22题）
    </div>
    <div class="exercise-container">
        <div class="exercise addition">
            <span class="number">1. </span>
            <span class="expression">7 + 89 = </span>
            <div class="input-group">
                <input type="number" id="answer_0" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(0, 96)">检查</button>
            </div>
            <div id="feedback_0" class="feedback"></div>
            <input type="hidden" id="correct_0" value="96">
        </div>
        <div class="exercise subtraction">
            <span class="number">2. </span>
            <span class="expression">88 - 68 = </span>
            <div class="input-group">
                <input type="number" id="answer_1" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(1, 20)">检查</button>
            </div>
            <div id="feedback_1" class="feedback"></div>
            <input type="hidden" id="correct_1" value="20">
        </div>
        <div class="exercise addition">
            <span class="number">3. </span>
            <span class="expression">13 + 63 = </span>
            <div class="input-group">
                <input type="number" id="answer_2" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(2, 76)">检查</button>
            </div>
            <div id="feedback_2" class="feedback"></div>
            <input type="hidden" id="correct_2" value="76">
        </div>
        <div class="exercise addition">
            <span class="number">4. </span>
            <span class="expression">3 + 71 = </span>
            <div class="input-group">
                <input type="number" id="answer_3" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(3, 74)">检查</button>
            </div>
            <div id="feedback_3" class="feedback"></div>
            <input type="hidden" id="correct_3" value="74">
        </div>
        <div class="exercise subtraction">
            <span class="number">5. </span>
            <span class="expression">83 - 50 = </span>
            <div class="input-group">
                <input type="number" id="answer_4" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(4, 33)">检查</button>
            </div>
            <div id="feedback_4" class="feedback"></div>
            <input type="hidden" id="correct_4" value="33">
        </div>
        <div class="exercise addition">
            <span class="number">6. </span>
            <span class="expression">19 + 58 = </span>
            <div class="input-group">
                <input type="number" id="answer_5" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(5, 77)">检查</button>
            </div>
            <div id="feedback_5" class="feedback"></div>
            <input type="hidden" id="correct_5" value="77">
        </div>
        <div class="exercise addition">
            <span class="number">7. </span>
            <span class="expression">21 + 31 = </span>
            <div class="input-group">
                <input type="number" id="answer_6" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(6, 52)">检查</button>
            </div>
            <div id="feedback_6" class="feedback"></div>
            <input type="hidden" id="correct_6" value="52">
        </div>
        <div class="exercise subtraction">
            <span class="number">8. </span>
            <span class="expression">31 - 28 = </span>
            <div class="input-group">
                <input type="number" id="answer_7" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(7, 3)">检查</button>
            </div>
            <div id="feedback_7" class="feedback"></div>
            <input type="hidden" id="correct_7" value="3">
        </div>
        <div class="exercise subtraction">
            <span class="number">9. </span>
            <span class="expression">51 - 44 = </span>
            <div class="input-group">
                <input type="number" id="answer_8" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(8, 7)">检查</button>
            </div>
            <div id="feedback_8" class="feedback"></div>
            <input type="hidden" id="correct_8" value="7">
        </div>
        <div class="exercise addition">
            <span class="number">10. </span>
            <span class="expression">4 + 51 = </span>
            <div class="input-group">
                <input type="number" id="answer_9" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(9, 55)">检查</button>
            </div>
            <div id="feedback_9" class="feedback"></div>
            <input type="hidden" id="correct_9" value="55">
        </div>
        <div class="exercise addition">
            <span class="number">11. </span>
            <span class="expression">6 + 58 = </span>
            <div class="input-group">
                <input type="number" id="answer_10" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(10, 64)">检查</button>
            </div>
            <div id="feedback_10" class="feedback"></div>
            <input type="hidden" id="correct_10" value="64">
        </div>
        <div class="exercise addition">
            <span class="number">12. </span>
            <span class="expression">6 + 17 = </span>
            <div class="input-group">
                <input type="number" id="answer_11" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(11, 23)">检查</button>
            </div>
            <div id="feedback_11" class="feedback"></div>
            <input type="hidden" id="correct_11" value="23">
        </div>
        <div class="exercise addition">
            <span class="number">13. </span>
            <span class="expression">7 + 40 = </span>
            <div class="input-group">
                <input type="number" id="answer_12" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(12, 47)">检查</button>
            </div>
            <div id="feedback_12" class="feedback"></div>
            <input type="hidden" id="correct_12" value="47">
        </div>
        <div class="exercise subtraction">
            <span class="number">14. </span>
            <span class="expression">26 - 11 = </span>
            <div class="input-group">
                <input type="number" id="answer_13" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(13, 15)">检查</button>
            </div>
            <div id="feedback_13" class="feedback"></div>
            <input type="hidden" id="correct_13" value="15">
        </div>
        <div class="exercise addition">
            <span class="number">15. </span>
            <span class="expression">44 + 48 = </span>
            <div class="input-group">
                <input type="number" id="answer_14" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(14, 92)">检查</button>
            </div>
            <div id="feedback_14" class="feedback"></div>
            <input type="hidden" id="correct_14" value="92">
        </div>
        <div class="exercise subtraction">
            <span class="number">16. </span>
            <span class="expression">25 - 13 = </span>
            <div class="input-group">
                <input type="number" id="answer_15" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(15, 12)">检查</button>
            </div>
            <div id="feedback_15" class="feedback"></div>
            <input type="hidden" id="correct_15" value="12">
        </div>
        <div class="exercise addition">
            <span class="number">17. </span>
            <span class="expression">40 + 59 = </span>
            <div class="input-group">
                <input type="number" id="answer_16" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(16, 99)">检查</button>
            </div>
            <div id="feedback_16" class="feedback"></div>
            <input type="hidden" id="correct_16" value="99">
        </div>
        <div class="exercise subtraction">
            <span class="number">18. </span>
            <span class="expression">34 - 19 = </span>
            <div class="input-group">
                <input type="number" id="answer_17" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(17, 15)">检查</button>
            </div>
            <div id="feedback_17" class="feedback"></div>
            <input type="hidden" id="correct_17" value="15">
        </div>
        <div class="exercise subtraction">
            <span class="number">19. </span>
            <span class="expression">80 - 15 = </span>
            <div class="input-group">
                <input type="number" id="answer_18" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(18, 65)">检查</button>
            </div>
            <div id="feedback_18" class="feedback"></div>
            <input type="hidden" id="correct_18" value="65">
        </div>
        <div class="exercise subtraction">
            <span class="number">20. </span>
            <span class="expression">41 - 5 = </span>
            <div class="input-group">
                <input type="number" id="answer_19" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(19, 36)">检查</button>
            </div>
            <div id="feedback_19" class="feedback"></div>
            <input type="hidden" id="correct_19" value="36">
        </div>
        <div class="exercise subtraction">
            <span class="number">21. </span>
            <span class="expression">91 - 11 = </span>
            <div class="input-group">
                <input type="number" id="answer_20" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(20, 80)">检查</button>
            </div>
            <div id="feedback_20" class="feedback"></div>
            <input type="hidden" id="correct_20" value="80">
        </div>
        <div class="exercise addition">
            <span class="number">22. </span>
            <span class="expression">37 + 48 = </span>
            <div class="input-group">
                <input type="number" id="answer_21" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(21, 85)">检查</button>
            </div>
            <div id="feedback_21" class="feedback"></div>
            <input type="hidden" id="correct_21" value="85">
        </div>
        <div class="exercise addition">
            <span class="number">23. </span>
            <span class="expression">38 + 61 = </span>
            <div class="input-group">
                <input type="number" id="answer_22" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(22, 99)">检查</button>
            </div>
            <div id="feedback_22" class="feedback"></div>
            <input type="hidden" id="correct_22" value="99">
        </div>
        <div class="exercise addition">
            <span class="number">24. </span>
            <span class="expression">10 + 47 = </span>
            <div class="input-group">
                <input type="number" id="answer_23" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(23, 57)">检查</button>
            </div>
            <div id="feedback_23" class="feedback"></div>
            <input type="hidden" id="correct_23" value="57">
        </div>
        <div class="exercise subtraction">
            <span class="number">25. </span>
            <span class="expression">40 - 20 = </span>
            <div class="input-group">
                <input type="number" id="answer_24" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(24, 20)">检查</button>
            </div>
            <div id="feedback_24" class="feedback"></div>
            <input type="hidden" id="correct_24" value="20">
        </div>
        <div class="exercise addition">
            <span class="number">26. </span>
            <span class="expression">3 + 6 = </span>
            <div class="input-group">
                <input type="number" id="answer_25" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(25, 9)">检查</button>
            </div>
            <div id="feedback_25" class="feedback"></div>
            <input type="hidden" id="correct_25" value="9">
        </div>
        <div class="exercise subtraction">
            <span class="number">27. </span>
            <span class="expression">35 - 2 = </span>
            <div class="input-group">
                <input type="number" id="answer_26" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(26, 33)">检查</button>
            </div>
            <div id="feedback_26" class="feedback"></div>
            <input type="hidden" id="correct_26" value="33">
        </div>
        <div class="exercise subtraction">
            <span class="number">28. </span>
            <span class="expression">72 - 7 = </span>
            <div class="input-group">
                <input type="number" id="answer_27" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(27, 65)">检查</button>
            </div>
            <div id="feedback_27" class="feedback"></div>
            <input type="hidden" id="correct_27" value="65">
        </div>
        <div class="exercise addition">
            <span class="number">29. </span>
            <span class="expression">13 + 57 = </span>
            <div class="input-group">
                <input type="number" id="answer_28" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(28, 70)">检查</button>
            </div>
            <div id="feedback_28" class="feedback"></div>
            <input type="hidden" id="correct_28" value="70">
        </div>
        <div class="exercise addition">
            <span class="number">30. </span>
            <span class="expression">27 + 65 = </span>
            <div class="input-group">
                <input type="number" id="answer_29" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(29, 92)">检查</button>
            </div>
            <div id="feedback_29" class="feedback"></div>
            <input type="hidden" id="correct_29" value="92">
        </div>
        <div class="exercise subtraction">
            <span class="number">31. </span>
            <span class="expression">35 - 23 = </span>
            <div class="input-group">
                <input type="number" id="answer_30" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(30, 12)">检查</button>
            </div>
            <div id="feedback_30" class="feedback"></div>
            <input type="hidden" id="correct_30" value="12">
        </div>
        <div class="exercise subtraction">
            <span class="number">32. </span>
            <span class="expression">96 - 67 = </span>
            <div class="input-group">
                <input type="number" id="answer_31" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(31, 29)">检查</button>
            </div>
            <div id="feedback_31" class="feedback"></div>
            <input type="hidden" id="correct_31" value="29">
        </div>
        <div class="exercise subtraction">
            <span class="number">33. </span>
            <span class="expression">74 - 3 = </span>
            <div class="input-group">
                <input type="number" id="answer_32" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(32, 71)">检查</button>
            </div>
            <div id="feedback_32" class="feedback"></div>
            <input type="hidden" id="correct_32" value="71">
        </div>
        <div class="exercise addition">
            <span class="number">34. </span>
            <span class="expression">10 + 16 = </span>
            <div class="input-group">
                <input type="number" id="answer_33" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(33, 26)">检查</button>
            </div>
            <div id="feedback_33" class="feedback"></div>
            <input type="hidden" id="correct_33" value="26">
        </div>
        <div class="exercise subtraction">
            <span class="number">35. </span>
            <span class="expression">99 - 99 = </span>
            <div class="input-group">
                <input type="number" id="answer_34" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(34, 0)">检查</button>
            </div>
            <div id="feedback_34" class="feedback"></div>
            <input type="hidden" id="correct_34" value="0">
        </div>
        <div class="exercise addition">
            <span class="number">36. </span>
            <span class="expression">3 + 54 = </span>
            <div class="input-group">
                <input type="number" id="answer_35" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(35, 57)">检查</button>
            </div>
            <div id="feedback_35" class="feedback"></div>
            <input type="hidden" id="correct_35" value="57">
        </div>
        <div class="exercise addition">
            <span class="number">37. </span>
            <span class="expression">6 + 82 = </span>
            <div class="input-group">
                <input type="number" id="answer_36" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(36, 88)">检查</button>
            </div>
            <div id="feedback_36" class="feedback"></div>
            <input type="hidden" id="correct_36" value="88">
        </div>
        <div class="exercise addition">
            <span class="number">38. </span>
            <span class="expression">12 + 83 = </span>
            <div class="input-group">
                <input type="number" id="answer_37" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(37, 95)">检查</button>
            </div>
            <div id="feedback_37" class="feedback"></div>
            <input type="hidden" id="correct_37" value="95">
        </div>
        <div class="exercise subtraction">
            <span class="number">39. </span>
            <span class="expression">91 - 37 = </span>
            <div class="input-group">
                <input type="number" id="answer_38" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(38, 54)">检查</button>
            </div>
            <div id="feedback_38" class="feedback"></div>
            <input type="hidden" id="correct_38" value="54">
        </div>
        <div class="exercise addition">
            <span class="number">40. </span>
            <span class="expression">16 + 71 = </span>
            <div class="input-group">
                <input type="number" id="answer_39" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(39, 87)">检查</button>
            </div>
            <div id="feedback_39" class="feedback"></div>
            <input type="hidden" id="correct_39" value="87">
        </div>
        <div class="exercise subtraction">
            <span class="number">41. </span>
            <span class="expression">70 - 21 = </span>
            <div class="input-group">
                <input type="number" id="answer_40" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(40, 49)">检查</button>
            </div>
            <div id="feedback_40" class="feedback"></div>
            <input type="hidden" id="correct_40" value="49">
        </div>
        <div class="exercise addition">
            <span class="number">42. </span>
            <span class="expression">10 + 14 = </span>
            <div class="input-group">
                <input type="number" id="answer_41" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(41, 24)">检查</button>
            </div>
            <div id="feedback_41" class="feedback"></div>
            <input type="hidden" id="correct_41" value="24">
        </div>
        <div class="exercise addition">
            <span class="number">43. </span>
            <span class="expression">7 + 73 = </span>
            <div class="input-group">
                <input type="number" id="answer_42" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(42, 80)">检查</button>
            </div>
            <div id="feedback_42" class="feedback"></div>
            <input type="hidden" id="correct_42" value="80">
        </div>
        <div class="exercise addition">
            <span class="number">44. </span>
            <span class="expression">14 + 79 = </span>
            <div class="input-group">
                <input type="number" id="answer_43" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(43, 93)">检查</button>
            </div>
            <div id="feedback_43" class="feedback"></div>
            <input type="hidden" id="correct_43" value="93">
        </div>
        <div class="exercise addition">
            <span class="number">45. </span>
            <span class="expression">1 + 26 = </span>
            <div class="input-group">
                <input type="number" id="answer_44" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(44, 27)">检查</button>
            </div>
            <div id="feedback_44" class="feedback"></div>
            <input type="hidden" id="correct_44" value="27">
        </div>
        <div class="exercise addition">
            <span class="number">46. </span>
            <span class="expression">36 + 48 = </span>
            <div class="input-group">
                <input type="number" id="answer_45" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(45, 84)">检查</button>
            </div>
            <div id="feedback_45" class="feedback"></div>
            <input type="hidden" id="correct_45" value="84">
        </div>
        <div class="exercise addition">
            <span class="number">47. </span>
            <span class="expression">9 + 83 = </span>
            <div class="input-group">
                <input type="number" id="answer_46" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(46, 92)">检查</button>
            </div>
            <div id="feedback_46" class="feedback"></div>
            <input type="hidden" id="correct_46" value="92">
        </div>
        <div class="exercise subtraction">
            <span class="number">48. </span>
            <span class="expression">51 - 6 = </span>
            <div class="input-group">
                <input type="number" id="answer_47" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(47, 45)">检查</button>
            </div>
            <div id="feedback_47" class="feedback"></div>
            <input type="hidden" id="correct_47" value="45">
        </div>
        <div class="exercise subtraction">
            <span class="number">49. </span>
            <span class="expression">81 - 62 = </span>
            <div class="input-group">
                <input type="number" id="answer_48" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(48, 19)">检查</button>
            </div>
            <div id="feedback_48" class="feedback"></div>
            <input type="hidden" id="correct_48" value="19">
        </div>
        <div class="exercise subtraction">
            <span class="number">50. </span>
            <span class="expression">91 - 13 = </span>
            <div class="input-group">
                <input type="number" id="answer_49" placeholder="?">
                <button class="check-btn" onclick="checkAnswer(49, 78)">检查</button>
            </div>
            <div id="feedback_49" class="feedback"></div>
            <input type="hidden" id="correct_49" value="78">
        </div>
    </div>
    <div class="submit-all">
        <button id="submitAllBtn" onclick="submitAllAnswers()">提交所有答案</button>
    </div>
</body>
</html>
